<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<head>
    <title>ИС "Аттестация рабочих мест"</title>
    <link rel="stylesheet" type="text/css" href="/arm/resources/css/style.css">
</head>
<body>


<f:view>
    <a4j:form id="frm" ajaxSubmit="true">

        <%@ include file="/pages/common/menu.jsp" %>

        <h:panelGrid columns="3">

            <h:outputText id="metNumLbl" value="Наименование объекта"/>
            <h:selectOneMenu id="num" value="#{metricBean.metric.obiekt}"  required="true"
                             converter="identifableConverter">
                <a4j:support event="onchange" reRender="per"/>
                <f:selectItems value="#{metricBean.obiektList}"/>
            </h:selectOneMenu>
            <rich:message for="num" styleClass="error" />

            <h:outputText id="metPerLbl" value="Наименование периода"/>
            <h:selectOneMenu id="per" value="#{metricBean.metric.dicPeriod}"  required="true"
                             converter="identifableConverter">
                <f:selectItems value="#{metricBean.periodList}"/>
            </h:selectOneMenu>
            <rich:message for="per" styleClass="error" />

            <h:outputText id="metPostLbl" value="Наименование должности"/>
            <h:selectOneMenu id="post" value="#{metricBean.metric.dicPost}"  required="true"
                             converter="identifableConverter">
                <f:selectItems value="#{metricBean.postList}"/>
            </h:selectOneMenu>
            <rich:message for="post" styleClass="error" />

            <h:outputText id="normMetLbl" value="Вид измерения"/>
            <a4j:region>
                <h:selectOneMenu id="normMetSom" value="#{metricBean.metric.dicMetricType}"  required="true"
                                 converter="identifableConverter">
                    <a4j:support event="onchange" reRender="normCatSom"/>
                    <f:selectItems value="#{metricBean.metricList}"/>
                </h:selectOneMenu>
            </a4j:region>
            <rich:message for="normMetSom" styleClass="error" />

            <h:outputText id="normCatLbl" value="Категория"/>
            <h:selectOneMenu id="normCatSom" value="#{metricBean.metric.dicCategory}"  required="true"
                             converter="identifableConverter">
                <f:selectItems value="#{metricBean.categoryList}"/>
            </h:selectOneMenu>
            <rich:message for="normCatSom" styleClass="error" />

            <h:outputText id="metValLbl" value="Значение"/>
            <h:inputText id="metValLblTxt" value="#{metricBean.metric.value}" maxlength="8"/>
            <rich:message for="metValLblTxt" styleClass="error" />

            <h:outputText id="metKeyLbl" value="Код рабочего места"/>
            <h:inputText id="metKeyLblTxt" value="#{metricBean.metric.keyWorkplace}" maxlength="8"/>
            <rich:message for="metKeyLblTxt" styleClass="error" />

            <h:outputText id="metNumberLbl" value="Количество рабочих мест"/>
            <h:inputText id="metNumberLblTxt" value="#{metricBean.metric.numberWorkplace}" maxlength="8"/>
            <rich:message for="metNumberLblTxt" styleClass="error" />

        </h:panelGrid>

        <h:panelGrid id="pnlButtonsRows" columns="2">
            <a4j:commandButton id="btnSave" action="#{metricBean.save}" value="Сохранить"/>
            <a4j:commandButton id="btnCancel" action="#{metricBean.cancel}" immediate="true" value="Отмена"/>
        </h:panelGrid>
    </a4j:form>
</f:view>
</body>
</html>